Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dns): allow http:// DoH resolvers #645

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lidel
Copy link
Member

@lidel lidel commented Jul 29, 2024

This PR allows people to run own DNS over HTTP(S) resolver on the same box or within same secure LAN, without setting up unnecessary TLS certs.

Main use case is to simplify self-hosting of ENS resolves by gateway operations etc.

allows people to run own DoH resolver on the same box
or within same secure VLAN/VPN/infra
@lidel lidel force-pushed the fix/allow-local-doh-endpoints branch from e99d6ba to f736895 Compare July 29, 2024 21:28
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.87%. Comparing base (0190b70) to head (f736895).
Report is 73 commits behind head on main.

Files with missing lines Patch % Lines
gateway/dns.go 0.00% 1 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #645      +/-   ##
==========================================
+ Coverage   59.75%   59.87%   +0.12%     
==========================================
  Files         238      238              
  Lines       29999    29999              
==========================================
+ Hits        17926    17963      +37     
+ Misses      10450    10418      -32     
+ Partials     1623     1618       -5     
Files with missing lines Coverage Δ
gateway/dns.go 37.77% <0.00%> (ø)

... and 13 files with indirect coverage changes

@@ -15,8 +15,8 @@ var defaultResolvers = map[string]string{
}

func newResolver(url string, opts ...doh.Option) (madns.BasicResolver, error) {
if !strings.HasPrefix(url, "https://") {
return nil, fmt.Errorf("invalid resolver url: %s", url)
if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "http://") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is going to be enough:
https://github.com/libp2p/go-doh-resolver/blob/f2e25860684789200e3a3a911dc9a74d01771d5b/resolver.go#L55

Note: AFAICT there is no DNS-over-HTTP spec for some reason it's specified as being over HTTPS, however I definitely see your point and have definitely felt the pain over the self-signed cert dance just to run local resolvers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, filled this PR because I am looking at https://github.com/libp2p/go-doh-resolver and https://github.com/multiformats/go-multiaddr-dns to wire up TTL (to fix #329 (comment) for DNSLinks), so likely will relax things there as well, and get back to this PR draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants